package com.web.base.log.service;

import com.blue.jdbc.JdbcDataSource;
import com.blue.jdbc.Page;
import com.web.base.log.dao.AccusationDao;
import com.web.base.log.model.Accusation;
import com.web.core.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 举报业务层
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2018年06月20日
 */
@Service("logAccusationService")
@Transactional
@JdbcDataSource(Const.DS_BASE)
public class AccusationService
{
	@Autowired
	private AccusationDao accusationDao;
	
	public AccusationService()
	{
	}
	
	public Accusation save(Accusation accusation)
	{
		if (accusation.getId() == null)
		{
			accusationDao.save(accusation);
		}
		else
		{
			accusationDao.update(accusation);
		}
		Accusation a = accusationDao.get(accusation.getId());
		return a;
	}
	
	public Accusation get(Integer id)
	{
		Accusation accusation = accusationDao.get(id);
		return accusation;
	}
	
	public Page<Accusation> list(Accusation accusation, Page<Accusation> page)
	{
		page = accusationDao.list(accusation, page);
		return page;
	}
	
}
